import Home from './pages/Home.vue';
import TestBackCommit from './pages/testBackCommit.vue';
import TestBackRun from './pages/testBackRun.vue';
// import sigsongGrid from './pages/sigsongGrid.vue';
import { createRouter,createWebHashHistory } from 'vue-router'

const routes = [
    {
        path:'/',
        component: Home,
        meta:{
         title:'回测软件'
        }
    },
    {
        name:'testBackCommit',
        path:'/testback/commit',
        component: TestBackCommit,
        meta:{
         title:'批量回测'
        }
    },
    {
        name:'testBackRun',
        path:'/testback/run',
        component: TestBackRun,
        meta:{
         title:'回测软件'
        },
        props:true
    },

]

const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes, // `routes: routes` 的缩写
})

//router设置页面标题
router.beforeEach((to, from, next) => {
/* 路由发生变化修改页面title */
if (to.meta.title) {
    document.title = to.meta.title
}
    next()
})

export default router;